﻿using System;
using System.Collections.Generic;
using System.Text;
using TerminationCall.Core;

namespace TerminationCall.Editor.Logic {

    public class LayerOriginator {

        private Layer _layer;

        internal Layer Layer { 
            get {
                return _layer;
            }
        }

        public LayerOriginator(Layer layer) {
            _layer = layer;
        }

        public LayerMemento CreateMemento(PaintTile[] paintTile) {
            return new LayerMemento(paintTile);
        }

        public void UndoMemento(LayerMemento fieldMemento) {

            LayerManager layerManager = new LayerManager(_layer);

            for (int i = fieldMemento.PaintTiles.Length - 1; i >= 0; i--) {
                fieldMemento.PaintTiles[i].UndoPaintTile();
            }
        }

        public void RedoMemento(LayerMemento fieldMemento) {

            LayerManager layerManager = new LayerManager(_layer);

            foreach (PaintTile paintTile in fieldMemento.PaintTiles) {
                paintTile.RedoPaintTile();
            }

        }
        
    }

}
